app.controller('cartCtrl',['$scope','cart',function($scope,cart){
//	console.log(cart.data);
    $scope.list=cart.data;
    $scope.status=cart.status;
    $scope.priceAll=0;
    $scope.selectBtn=true;
    $scope.selectAll=function(){
        for(var o in cart.data){
             cart.data[o].selec= $scope.selectBtn;
        }
     }
    $scope.selectFns=function(){
    	var status=true;
    	for(var o in cart.data){
    		if(!cart.data[o].selec){
    			status=false;
    		}
    	}
    	 $scope.selectBtn=status;
    }
    function count(){
    	var num=0;
    	for(var o in cart.data){
    		num+=cart.data[o].num*cart.data[o].price;
    	}
    	$scope.priceAll=num;
    }
    
}])
